//
//  JYJDownLoadTableViewCell.m
//  HappyListen
//
//  Created by 冀永金 on 16/9/20.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "JYJDownLoadTableViewCell.h"
#import "BaseLabel.h"
#import "JYJTAMacro.h"
#import "Masonry.h"
@interface JYJDownLoadTableViewCell ()
@property (nonatomic, strong) UIImageView *backImage;
@property (nonatomic, strong) UIImageView *backImageTwo;
@property (nonatomic, strong) UIView *redView;




@end
@implementation JYJDownLoadTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return  self;
}

- (void)createSubViews {
    self.redView = [[UIView alloc]init];
    [self.contentView addSubview:_redView];
    _redView.backgroundColor = [UIColor colorWithRed:0.83 green:0.15 blue:0.11 alpha:1.00];
    self.musicImage = [[UIImageView alloc]init];
    [self.contentView addSubview:_musicImage];
    self.backImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"find_cat_cover"]];
    self.backImage.userInteractionEnabled = YES;
    [self.contentView addSubview:_backImage];
    self.backImageTwo = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"catinfo_item_bg"]];
    self.backImageTwo.userInteractionEnabled = YES;
    [self.contentView addSubview:_backImageTwo];
    self.titleLabel = [[BaseLabel alloc]init];
    self.titleLabel.textColor = [UIColor whiteColor];
    self.titleLabel.numberOfLines = 0;
    [self.contentView addSubview:_titleLabel];
    
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    [self.redView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(0);
        make.left.equalTo(self.contentView.mas_left).with.offset(44);
        make.width.mas_equalTo(2);
        make.height.mas_equalTo(self.contentView.bounds.size.height - 80);
    }];
    [self.backImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0);
        make.left.equalTo(self.contentView.mas_left).with.offset(5);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(80);
    }];
    [self.musicImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView.mas_bottom).with.offset(-15);
        make.left.equalTo(self.contentView.mas_left).with.offset(20);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
    }];
    self.musicImage.layer.cornerRadius = 25;
    self.musicImage.clipsToBounds = YES;
    [self.backImageTwo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.with.offset(10);
        make.left.equalTo(self.backImage.mas_right).with.offset(15);
        make.right.equalTo(self.contentView.mas_right).with.offset(0);
        make.height.mas_equalTo(90);
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.with.offset(10);
        make.left.equalTo(self.backImage.mas_right).with.offset(50);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(SCREEN_WIDTH - 150);
    }];
    
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
